//
//  TzSettingViewController.m
//  quickBatchManager
//
//  Created by 王定波 on 15/9/29.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "TzSettingViewController.h"

@interface TzSettingViewController ()

@end

@implementation TzSettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}



-(void)initUI
{
    _mainview.backgroundColor=COLOR_ST_BG;
    _mainview.layer.cornerRadius=5;
    
    _mainview.layer.shadowRadius = 10.0;
    _mainview.layer.shadowColor = [UIColor blackColor].CGColor; //设置阴影的颜色为黑色
    _mainview.layer.shadowOpacity = 1.0; //设置阴影的不透明度
    _mainview.layer.shadowOffset = CGSizeMake(0, 3);
    
    [_collectionView registerClass:[TzCollectionViewCell class] forCellWithReuseIdentifier:@"TzCollectionViewCell"];
    
    self.view.backgroundColor=[UIColor clearColor];
    _collectionView.backgroundColor=[UIColor clearColor];
    
}

#pragma mark -- UICollectionViewDataSource 
//定义展示的UICollectionViewCell的个数
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 3;
}

//定义展示的Section的个数
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}
//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * CellIdentifier = @"TzCollectionViewCell";
    TzCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
    cell.backgroundColor=[UIColor clearColor];
    
    if(indexPath.row==2)
        [cell setData:nil];
    else [cell setData:[[TzModel alloc] init]];
    

    return cell;
}


#pragma mark --UICollectionViewDelegateFlowLayout
//定义每个UICollectionView 的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(255, 145);
}
//定义每个UICollectionView 的 margin
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(10, 10, 10, 10);
}
#pragma mark --UICollectionViewDelegate
//UICollectionView被选中时调用的方法
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell * cell = (UICollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
    cell.backgroundColor = [UIColor whiteColor];
}
//返回这个UICollectionView是否可以被选择
-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

@end
